package gold.contest;

import java.util.*;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC5161 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int canBeTypedWords(String text, String brokenLetters) {
            Set<Character> bset = new HashSet<>();
            for (char ch : brokenLetters.toCharArray()) {
                bset.add(ch);
            }

            int res = 0;
            final String[] split = text.split(" ");
            for (String word : split) {
                boolean curCan = true;
                for (char ch : word.toCharArray()) {
                    if (bset.contains(ch)) {
                        curCan = false;
                        break;
                    }
                }

                if (curCan) ++res;
            }

            return res;
        }
    }


    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.canBeTypedWords("leet code", "lt"));
    }

    public static void main(String[] args) throws Exception {
        LC5161 an = new LC5161();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
